package com.codexsoft.test;

import com.codexsoft.test.entities.User;
import org.apache.wicket.extensions.wizard.WizardStep;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.model.PropertyModel;

/**
 * Created by IntelliJ IDEA.
 * User: Admin
 * Date: 24.08.11
 * Time: 17:04
 * To change this template use File | Settings | File Templates.
 */
public class RegPanel2 extends WizardStep {
    User user;

    public RegPanel2() {
        super("Register new user: 2-d step", "Please, answer " +
                "a few more questions, to get some additional information about you");
        Form form = new Form("regform");
        user = new User();
        TextField country = new TextField("country", new PropertyModel(user, "country"));
        TextField city = new TextField("city", new PropertyModel(user, "city"));
        TextField university = new TextField("university", new PropertyModel(user, "university"));
        TextField faculty = new TextField("faculty", new PropertyModel(user, "faculty"));
        TextField speciality = new TextField("speciality", new PropertyModel(user, "speciality"));
        form.add(country);
        form.add(city);
        form.add(university);
        form.add(faculty);
        form.add(speciality);
        add(form);
    }

    @Override
    public void applyState() {
        RegistrationWizard.getUser().setCountry(user.getCountry());
        RegistrationWizard.getUser().setCity(user.getCity());
        RegistrationWizard.getUser().setUniversity(user.getUniversity());
        RegistrationWizard.getUser().setFaculty(user.getFaculty());
        RegistrationWizard.getUser().setSpeciality(user.getSpeciality());
    }
}
